package session

import "context"

type YSessionKey struct{}

func WithCtx(ctx context.Context, session *SessionManager) context.Context {
	return context.WithValue(ctx, YSessionKey{}, session)
}

func FromCtx(ctx context.Context) (*SessionManager, bool) {
	val := ctx.Value(YSessionKey{})
	if val == nil {
		return nil, false
	}
	sess, ok := val.(*SessionManager)
	return sess, ok
}
